OS தொகுதி என்றால் என்ன?
Node.js இல் OS தொகுதி அடிப்படை இயக்க முறைமையுடன் தொடர்பு கொள்வதற்கான சக்திவாய்ந்த பயன்பாடுகளின் தொகுப்பை வழங்குகிறது.
இது குறுக்கு-மேடை வழியில் கணினி தொடர்பான தகவல்களை அணுகவும் பொதுவான இயக்க முறைமை பணிகளைச் செய்யவும் வழங்குகிறது.
கணினி தகவல் பெறுதல்
CPU, நினைவகம், மேடை, முதலியன
பயனர் மற்றும் நெட்வொர்க் தகவல்
பயனர் விவரங்கள் மற்றும் நெட்வொர்க் இடைமுகங்கள்
கணினி வளங்களை கண்காணித்தல்
செயல்திறன் மற்றும் வள பயன்பாட்டைக் கண்காணித்தல்
OS தொகுதியுடன் தொடங்குதல்
தொகுதியை இறக்குமதி செய்தல்
OS தொகுதி Node.js இன் முக்கிய தொகுதியாகும், எனவே எந்த நிறுவலும் தேவையில்லை.
நீங்கள் CommonJS அல்லது ES தொகுதிகள் இலக்கணத்தைப் பயன்படுத்தி அதை இறக்குமதி செய்யலாம்:
CommonJS (Node.js இல் இயல்புநிலை)
const os = require('os');
ES Modules (Node.js 14+ or with "type": "module" in package.json)
import os from 'os';
// or
import { arch, platform, cpus } from 'os';
அடிப்படை பயன்பாட்டு எடுத்துக்காட்டு
const os = require('os');
// Basic system information
console.log(`OS Platform: ${os.platform()}`);
console.log(`OS Type: ${os.type()}`);
console.log(`OS Release: ${os.release()}`);
console.log(`CPU Architecture: ${os.arch()}`);
console.log(`Hostname: ${os.hostname()}`);
// Memory information
const totalMemGB = (os.totalmem() / (1024 * 1024 * 1024)).toFixed(2);
const freeMemGB = (os.freemem() / (1024 * 1024 * 1024)).toFixed(2);
console.log(`Memory: ${freeMemGB}GB free of ${totalMemGB}GB`);
// User information
const userInfo = os.userInfo();
console.log(`Current User: ${userInfo.username}`);
console.log(`Home Directory: ${os.homedir()}`);
OS தொகுதி குறிப்பு:
அனைத்து OS தொகுதி முறைகளும் ஒத்திசைவானவை மற்றும் உடனடியாக முடிவுகளை வழங்குகின்றன.
செயல்திறன்-முக்கியமான பயன்பாடுகளுக்கு, os.cpus() அல்லது os.networkInterfaces() போன்ற அடிக்கடி அழைக்கப்படக்கூடிய முறைகளின் முடிவுகளை கேச் செய்வதைக் கவனியுங்கள்.
கணினி தகவல்
os.arch()
Node.js பைனரி தொகுக்கப்பட்ட இயக்க முறைமை CPU கட்டமைப்பை வழங்குகிறது.
const os = require('os');
// Get CPU architecture
console.log(`CPU Architecture: ${os.arch()}`);
// Common values:
// - 'x64' for 64-bit systems
// - 'arm' for ARM processors
// - 'arm64' for 64-bit ARM
// - 'ia32' for 32-bit x86
// - 'mips' for MIPS processors
os.platform()
இயக்க முறைமை மேடையை அடையாளம் காணும் ஒரு சரத்தை வழங்குகிறது.
const os = require('os');
// Get platform information
const platform = os.platform();
console.log(`Platform: ${platform}`);
// Common values:
// - 'darwin' for macOS
// - 'win32' for Windows (both 32-bit and 64-bit)
// - 'linux' for Linux
// - 'freebsd' for FreeBSD
// - 'openbsd' for OpenBSD
os.type()
POSIX அமைப்புகளில் uname மூலம் திரும்பப் பெறப்பட்டது போன்ற இயக்க முறைமை பெயரை வழங்குகிறது, அல்லது விண்டோஸில் ver கட்டளை மூலம்.
const os = require('os');
// Get OS type
console.log(`OS Type: ${os.type()}`);
// Examples:
// - 'Linux' on Linux
// - 'Darwin' on macOS
// - 'Windows_NT' on Windows
os.release()
இயக்க முறைமை வெளியீட்டு எண்ணை வழங்குகிறது.
const os = require('os');
// Get OS release information
console.log(`OS Release: ${os.release()}`);
// Examples:
// - '10.0.19044' on Windows 10
// - '21.6.0' on macOS Monterey
// - '5.15.0-46-generic' on Ubuntu
os.version()
கர்னல் பதிப்பை அடையாளம் காணும் ஒரு சரத்தை வழங்குகிறது. விண்டோஸில், இது கட்டமைப்பு தகவல்களை உள்ளடக்கியது.
const os = require('os');
// Get kernel version
console.log(`Kernel Version: ${os.version()}`);
// Example output:
// - Windows: 'Windows 10 Enterprise 10.0.19044'
// - Linux: '#49-Ubuntu SMP Tue Aug 2 08:49:28 UTC 2022'
// - macOS: 'Darwin Kernel Version 21.6.0: ...'
பயனர் மற்றும் சூழல்
os.userInfo()
தற்போது பயனுள்ள பயனர் பற்றிய தகவல்களை வழங்குகிறது.
const os = require('os');
// Get current user information
const user = os.userInfo();
console.log('User Information:');
console.log(`- Username: ${user.username}`);
console.log(`- User ID: ${user.uid}`);
console.log(`- Group ID: ${user.gid}`);
console.log(`- Home Directory: ${user.homedir}`);
// On Windows, you can also get the user's domain
if (os.platform() === 'win32') {
console.log(`- Domain: ${user.domain || 'N/A'}`);
}
// Note: user.shell is only available on POSIX platforms
if (user.shell) {
console.log(`- Default Shell: ${user.shell}`);
}
os.homedir()
தற்போதைய பயனரின் வீட்டு அடைவை வழங்குகிறது.
const os = require('os');
const path = require('path');
// Get the home directory
const homeDir = os.homedir();
console.log(`Home Directory: ${homeDir}`);
// Example: Create a path to a config file in the user's home directory
const configPath = path.join(homeDir, '.myapp', 'config.json');
console.log(`Config file will be saved to: ${configPath}`);
os.hostname()
இயக்க முறைமையின் ஹோஸ்ட்பெயரை வழங்குகிறது.
const os = require('os');
// Get the system hostname
const hostname = os.hostname();
console.log(`Hostname: ${hostname}`);
// Example: Use hostname in logging or configuration
console.log(`Server started on ${hostname} at ${new Date().toISOString()}`);
os.tmpdir()
இயக்க முறைமையின் இயல்புநிலை தற்காலிக கோப்புகளுக்கான அடைவை வழங்குகிறது.
const os = require('os');
// Get the system default temp dir
console.log(`Temporary Directory: ${os.tmpdir()}`);
கணினி வளங்கள்
os.cpus()
ஒவ்வொரு லாஜிக்கல் CPU கோர் பற்றிய தகவல்களைக் கொண்ட பொருள்களின் வரிசையை வழங்குகிறது.
const os = require('os');
// Get CPU information
const cpus = os.cpus();
console.log(`Number of CPU Cores: ${cpus.length}`);
// Display information about each CPU core
cpus.forEach((cpu, index) => {
console.log(`\nCPU Core ${index + 1}:`);
console.log(`- Model: ${cpu.model}`);
console.log(`- Speed: ${cpu.speed} MHz`);
console.log('- Times (ms):', {
user: cpu.times.user,
nice: cpu.times.nice,
sys: cpu.times.sys,
idle: cpu.times.idle,
irq: cpu.times.irq
});
});
CPU பயன்பாட்டைக் கணக்கிடுதல் (எடுத்துக்காட்டு, இரண்டு அளவீடுகள் தேவை)
// Calculate total CPU usage (example, requires two measurements)
function calculateCpuUsage(prevCpus) {
const currentCpus = os.cpus();
const usage = [];
for (let i = 0; i < currentCpus.length; i++) {
const current = currentCpus[i];
const prev = prevCpus ? prevCpus[i] : { times: { user: 0, nice: 0, sys: 0, idle: 0, irq: 0 } };
const prevIdle = prev.times.idle;
const idle = current.times.idle - prevIdle;
let total = 0;
for (const type in current.times) {
total += current.times[type] - (prev.times[type] || 0);
}
const usagePercent = ((1 - idle / total) * 100).toFixed(1);
usage.push(parseFloat(usagePercent));
}
return {
perCore: usage,
average: (usage.reduce((a, b) => a + b, 0) / usage.length).toFixed(1),
cpus: currentCpus
};
}
// Example usage of CPU usage calculation
console.log('\nCPU Usage (requires two measurements):');
const firstMeasure = os.cpus();
// Simulate some CPU work
for (let i = 0; i < 1000000000; i++) {}
const usage = calculateCpuUsage(firstMeasure);
console.log(`Average CPU Usage: ${usage.average}%`);
os.totalmem() மற்றும் os.freemem()
முறையே பைட்டுகளில் மொத்த மற்றும் இலவச கணினி நினைவகத்தை வழங்குகிறது.
const os = require('os');
// Format bytes to human-readable format
function formatBytes(bytes, decimals = 2) {
if (bytes === 0) return '0 Bytes';
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
// Get memory information
const totalMem = os.totalmem();
const freeMem = os.freemem();
const usedMem = totalMem - freeMem;
const usagePercent = ((usedMem / totalMem) * 100).toFixed(2);
console.log('Memory Information:');
console.log(`- Total Memory: ${formatBytes(totalMem)}`);
console.log(`- Free Memory: ${formatBytes(freeMem)} (${((freeMem / totalMem) * 100).toFixed(2)}%)`);
console.log(`- Used Memory: ${formatBytes(usedMem)} (${usagePercent}%)`);
// Example: Check if there's enough free memory
const MIN_FREE_MEMORY = 200 * 1024 * 1024; // 200MB
if (freeMem < MIN_FREE_MEMORY) {
console.warn('Warning: Low on memory!');
} else {
console.log('System has sufficient memory available');
}
os.loadavg()
1, 5, மற்றும் 15 நிமிட சராசரி சுமைகளைக் கொண்ட வரிசையை வழங்குகிறது.
const os = require('os');
// Get load averages
const loadAverages = os.loadavg();
console.log('System Load Averages (1, 5, 15 min):', loadAverages);
// On Linux/Unix, load average represents the average system load over the last 1, 5, and 15 minutes
// The values represent the number of processes in the system run queue
const [oneMin, fiveMin, fifteenMin] = loadAverages;
const cpuCount = os.cpus().length;
console.log(`1-minute load average: ${oneMin.toFixed(2)} (${(oneMin / cpuCount * 100).toFixed(1)}% of ${cpuCount} cores)`);
console.log(`5-minute load average: ${fiveMin.toFixed(2)}`);
console.log(`15-minute load average: ${fifteenMin.toFixed(2)}`);
// Example: Check if system is under heavy load
const isSystemOverloaded = oneMin > cpuCount * 1.5;
if (isSystemOverloaded) {
console.warn('Warning: System is under heavy load!');
} else {
console.log('System load is normal');
}
நெட்வொர்க் தகவல்
os.networkInterfaces()
நெட்வொர்க் முகவரி ஒதுக்கப்பட்டுள்ள நெட்வொர்க் இடைமுகங்களைக் கொண்ட ஒரு பொருளை வழங்குகிறது.
const os = require('os');
// Get network interfaces information
const networkInterfaces = os.networkInterfaces();
console.log('Network Interfaces:');
// Iterate over each network interface
Object.entries(networkInterfaces).forEach(([name, addresses]) => {
console.log(`\nInterface: ${name}`);
addresses.forEach((address) => {
console.log(`- Family: ${address.family}`);
console.log(` Address: ${address.address}`);
console.log(` Netmask: ${address.netmask}`);
console.log(` MAC: ${address.mac || 'N/A'}`);
console.log(` Internal: ${address.internal}`);
});
});
// Example: Find the first non-internal IPv4 address
function getLocalIpAddress() {
const interfaces = os.networkInterfaces();
for (const name of Object.keys(interfaces)) {
for (const iface of interfaces[name]) {
if (iface.family === 'IPv4' && !iface.internal) {
return iface.address;
}
}
}
return '127.0.0.1'; // Fallback to localhost
}
const localIp = getLocalIpAddress();
console.log(`\nLocal IP Address: ${localIp}`);
os.uptime()
கணினி இயங்கும் நேரத்தை விநாடிகளில் வழங்குகிறது.
const os = require('os');
// Get system uptime in seconds
const uptime = os.uptime();
console.log(`System Uptime: ${uptime} seconds`);
// Format uptime in a more readable way
const uptimeDays = Math.floor(uptime / (60 * 60 * 24));
const uptimeHours = Math.floor((uptime % (60 * 60 * 24)) / (60 * 60));
const uptimeMinutes = Math.floor((uptime % (60 * 60)) / 60);
const uptimeSeconds = Math.floor(uptime % 60);
console.log(`System has been running for: ${uptimeDays} days, ${uptimeHours} hours, ${uptimeMinutes} minutes, ${uptimeSeconds} seconds`);
OS மாறிலிகள் மற்றும் பயன்பாடுகள்
os.constants
பிழை குறியீடுகள், செயல்முறை சிக்னல்கள் மற்றும் பலவற்றுக்கான பொதுவாகப் பயன்படுத்தப்படும் இயக்க முறைமை குறிப்பிட்ட மாறிலிகளைக் கொண்ட ஒரு பொருளை வழங்குகிறது.
const os = require('os');
// Get all signal constants
console.log('Signal Constants:', os.constants.signals);
// Example: Handle common signals
process.on('SIGINT', () => {
console.log('Received SIGINT. Performing cleanup...');
process.exit(0);
});
process.on('SIGTERM', () => {
console.log('Received SIGTERM. Shutting down gracefully...');
process.exit(0);
});
console.log('Process is running. Press Ctrl+C to exit.');
os.EOL
தற்போதைய இயக்க முறைமைக்கான வரி முடிவு மார்க்கரை வழங்குகிறது.
const os = require('os');
const fs = require('fs');
// Get the end-of-line marker for the current OS
console.log('End of Line character:', JSON.stringify(os.EOL));
// Example: Write a file with platform-specific line endings
const lines = [
'First line',
'Second line',
'Third line'
];
// Join lines with the correct EOL character
const content = lines.join(os.EOL);
fs.writeFileSync('output.txt', content);
console.log('File written with platform-appropriate line endings');
சிறந்த நடைமுறைகள்
1. பாதைகளை சரியாக கையாளுதல்
குறுக்கு-மேடை பொருந்தக்கூடிய தன்மையை உறுதி செய்ய கோப்பு பாதைகளுக்கு சரம் இணைப்புக்கு பதிலாக எப்போதும் path.join() பயன்படுத்தவும்.
// Good
const filePath = path.join(os.homedir(), 'app', 'config.json');
// Bad (won't work on Windows)
const badPath = `${os.homedir()}/app/config.json`;
2. os.EOL உடன் எச்சரிக்கையாக இருங்கள்
கோப்புகளை எழுதும் போது வரி முடிவுகளைப் பற்றி அறிந்து கொள்ளுங்கள். குறுக்கு-மேடை பொருந்தக்கூடிய தன்மைக்கு os.EOL பயன்படுத்தவும்.
const content = `First Line${os.EOL}Second Line${os.EOL}Third Line`;
fs.writeFileSync('output.txt', content, 'utf8');
3. நினைவக கட்டுப்பாடுகளை கையாளுதல்
நினைவக தீவிர செயல்பாடுகளைச் செய்வதற்கு முன் கிடைக்கக்கூடிய நினைவகத்தைச் சரிபார்க்கவும்.
const MIN_FREE_MEMORY_MB = 500; // 500MB minimum free memory
function canPerformMemoryIntensiveOperation() {
const freeMemMB = os.freemem() / (1024 * 1024);
return freeMemMB > MIN_FREE_MEMORY_MB;
}
if (!canPerformMemoryIntensiveOperation()) {
console.warn('Not enough free memory to perform this operation');
// Handle the error appropriately
}
நடைமுறை எடுத்துக்காட்டுகள்
கணினி தகவல் டாஷ்போர்டு
இந்த எடுத்துக்காட்டு ஒரு விரிவான கணினி தகவல் அறிக்கையை உருவாக்குகிறது:
const os = require('os');
function getSystemInfo() {
const info = {
os: {
type: os.type(),
platform: os.platform(),
architecture: os.arch(),
release: os.release(),
hostname: os.hostname(),
uptime: formatUptime(os.uptime())
},
user: {
username: os.userInfo().username,
homedir: os.homedir(),
tempdir: os.tmpdir()
},
memory: {
total: formatBytes(os.totalmem()),
free: formatBytes(os.freemem()),
usage: `${((1 - os.freemem() / os.totalmem()) * 100).toFixed(2)}%`
},
cpu: {
model: os.cpus()[0].model,
cores: os.cpus().length,
speed: `${os.cpus()[0].speed} MHz`
}
};
return info;
}
function formatUptime(seconds) {
const days = Math.floor(seconds / (60 * 60 * 24));
const hours = Math.floor((seconds % (60 * 60 * 24)) / (60 * 60));
const minutes = Math.floor((seconds % (60 * 60)) / 60);
const secs = Math.floor(seconds % 60);
return `${days}d ${hours}h ${minutes}m ${secs}s`;
}
function formatBytes(bytes) {
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) return '0 Bytes';
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return `${(bytes / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
}
// Display the system information dashboard
const systemInfo = getSystemInfo();
console.log('======= SYSTEM INFORMATION DASHBOARD =======');
console.log(JSON.stringify(systemInfo, null, 2));
// Display in a more formatted way
console.log('\n======= FORMATTED SYSTEM INFORMATION =======');
console.log(`OS: ${systemInfo.os.type} (${systemInfo.os.platform} ${systemInfo.os.architecture})`);
console.log(`Version: ${systemInfo.os.release}`);
console.log(`Hostname: ${systemInfo.os.hostname}`);
console.log(`Uptime: ${systemInfo.os.uptime}`);
console.log(`User: ${systemInfo.user.username}`);
console.log(`Home Directory: ${systemInfo.user.homedir}`);
console.log(`CPU: ${systemInfo.cpu.model}`);
console.log(`Cores: ${systemInfo.cpu.cores}`);
console.log(`Speed: ${systemInfo.cpu.speed}`);
console.log(`Memory Total: ${systemInfo.memory.total}`);
console.log(`Memory Free: ${systemInfo.memory.free}`);
console.log(`Memory Usage: ${systemInfo.memory.usage}`);
வள கண்காணிப்பாளர்
இந்த எடுத்துக்காட்டு ஒரு விநாடிக்கு ஒருமுறை புதுப்பிக்கும் அடிப்படை வள கண்காணிப்பாளரை உருவாக்குகிறது:
const os = require('os');
function monitorResources() {
console.clear(); // Clear console for a cleaner display
const now = new Date().toLocaleTimeString();
console.log(`======= RESOURCE MONITOR (${now}) =======`);
// CPU Usage
const cpus = os.cpus();
console.log(`\nCPU Cores: ${cpus.length}`);
// Calculate CPU usage (this is approximate since we need two measurements)
const cpuUsage = cpus.map((cpu, index) => {
const total = Object.values(cpu.times).reduce((acc, tv) => acc + tv, 0);
const idle = cpu.times.idle;
const usage = ((total - idle) / total * 100).toFixed(1);
return `Core ${index}: ${usage}% used`;
});
console.log(cpuUsage.join('\n'));
// Memory Usage
const totalMem = os.totalmem();
const freeMem = os.freemem();
const usedMem = totalMem - freeMem;
console.log('\nMemory Usage:');
console.log(`Total: ${formatBytes(totalMem)}`);
console.log(`Used: ${formatBytes(usedMem)} (${(usedMem / totalMem * 100).toFixed(1)}%)`);
console.log(`Free: ${formatBytes(freeMem)} (${(freeMem / totalMem * 100).toFixed(1)}%)`);
// System Uptime
console.log(`\nSystem Uptime: ${formatUptime(os.uptime())}`);
// Process Info
console.log('\nProcess Information:');
console.log(`PID: ${process.pid}`);
console.log(`Memory Usage: ${formatBytes(process.memoryUsage().rss)}`);
console.log(`User: ${os.userInfo().username}`);
}
function formatBytes(bytes) {
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
if (bytes === 0) return '0 Bytes';
const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return `${(bytes / Math.pow(1024, i)).toFixed(2)} ${sizes[i]}`;
}
function formatUptime(seconds) {
const days = Math.floor(seconds / (60 * 60 * 24));
const hours = Math.floor((seconds % (60 * 60 * 24)) / (60 * 60));
const minutes = Math.floor((seconds % (60 * 60)) / 60);
const secs = Math.floor(seconds % 60);
return `${days}d ${hours}h ${minutes}m ${secs}s`;
}
// Initial display
monitorResources();
// Update every second (note: in a real application, you might not want
// to update this frequently as it uses CPU resources)
const intervalId = setInterval(monitorResources, 1000);
// In a real application, you would need to handle cleanup:
// clearInterval(intervalId);
// For this example, we'll run for 10 seconds then stop
console.log('Monitor will run for 10 seconds...');
setTimeout(() => {
clearInterval(intervalId);
console.log('\nResource monitoring stopped.');
}, 10000);
மேடை-குறிப்பிட்ட நடத்தை
இந்த எடுத்துக்காட்டு இயக்க முறைமையின் அடிப்படையில் உங்கள் பயன்பாட்டின் நடத்தையை எவ்வாறு சரிசெய்வது என்பதை நிரூபிக்கிறது:
const os = require('os');
const fs = require('fs');
const path = require('path');
// Function to determine a good location for app data based on the OS
function getAppDataPath(appName) {
const platform = os.platform();
let appDataPath;
switch (platform) {
case 'win32': // Windows
appDataPath = path.join(process.env.APPDATA || '', appName);
break;
case 'darwin': // macOS
appDataPath = path.join(os.homedir(), 'Library', 'Application Support', appName);
break;
case 'linux': // Linux
appDataPath = path.join(os.homedir(), '.config', appName);
break;
default: // Fallback for other platforms
appDataPath = path.join(os.homedir(), `.${appName}`);
}
return appDataPath;
}
// Function to get appropriate command based on OS
function getOpenCommand() {
const platform = os.platform();
switch (platform) {
case 'win32': // Windows
return 'start';
case 'darwin': // macOS
return 'open';
default: // Linux and others
return 'xdg-open';
}
}
// Example usage
const appName = 'myapp';
const appDataPath = getAppDataPath(appName);
const openCommand = getOpenCommand();
console.log(`OS Platform: ${os.platform()}`);
console.log(`OS Type: ${os.type()}`);
console.log(`Recommended App Data Path: ${appDataPath}`);
console.log(`Open Command: ${openCommand}`);
// Example of platform-specific behavior
console.log('\nPlatform-Specific Actions:');
if (os.platform() === 'win32') {
console.log('- Using Windows-specific registry functions');
console.log('- Setting up Windows service');
} else if (os.platform() === 'darwin') {
console.log('- Using macOS keychain for secure storage');
console.log('- Setting up launchd agent');
} else if (os.platform() === 'linux') {
console.log('- Using Linux systemd for service management');
console.log('- Setting up dbus integration');
}
// Example of checking for available memory and adjusting behavior
const availableMemGB = os.freemem() / (1024 * 1024 * 1024);
console.log(`\nAvailable Memory: ${availableMemGB.toFixed(2)} GB`);
if (availableMemGB < 0.5) {
console.log('Low memory mode activated: reducing cache size and disabling features');
} else if (availableMemGB > 4) {
console.log('High memory mode activated: increasing cache size and enabling all features');
} else {
console.log('Standard memory mode activated: using default settings');
}
// Example of CPU core detection for parallel processing
const cpuCount = os.cpus().length;
console.log(`\nCPU Cores: ${cpuCount}`);
const recommendedWorkers = Math.max(1, cpuCount - 1); // Leave one core for the system
console.log(`Recommended worker processes: ${recommendedWorkers}`);
சுருக்கம்
Node.js OS தொகுதி இயக்க முறைமையுடன் தொடர்பு கொள்வதற்கான சக்திவாய்ந்த கருவிகளின் தொகுப்பை வழங்குகிறது.
இதன் மூலம், நீங்கள் இவற்றைச் செய்யலாம்:
இந்த திறன்கள் குறிப்பாக பயனுள்ளதாக இருக்கும்:
குறுக்கு-மேடை பயன்பாடுகள்
ஹோஸ்ட் சூழலுக்கு ஏற்ப மாற்றியமைக்கும்
கணினி வளங்களைக் கண்காணித்தல்
செயல்திறன் மற்றும் வள பயன்பாட்டைக் கண்காணித்தல்
கண்டறியும் கருவிகள்
கண்டறியும் கருவிகளை உருவாக்குதல்
OS தொகுதியைப் பயன்படுத்துவதன் மூலம், உங்கள் Node.js பயன்பாடுகளை மிகவும் வலுவான, திறமையான மற்றும் வெவ்வேறு இயக்க சூழல்களுக்கு ஏற்ப மாற்றியமைக்கும் வகையில் உருவாக்கலாம்.
பயிற்சி
இயக்க முறைமை தொடர்பான பயன்பாட்டு முறைகள் மற்றும் பண்புகளை வழங்கும் சரியான தொகுதியை இழுத்து விடவும்.
The ______ module.